<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Title</title>
    <script src="../js/vue.js"></script>
</head>

<body>
    <div id="app">
        <!-- 使用v-bind不支持驼峰命名,如果使用需要  cInfo  转换为 c-info -->
        <cpn v-bind:c-info="info" :child-message="message"></cpn>
    </div>




    <template id="CPN">
       <div>
        <h2>{{cInfo}}</h2>
        <h2>{{childMessage}}</h2>
       </div>
    </template>



    <script>
        //
        const cpn = ({
            template: '#CPN',
            data() {
                return {

                }
            },
            props: {
                cInfo: {
                    type: Object,
                    default () {
                        return {
                            name: '默认',
                            age: 0,
                            sex: '男'
                        }
                    }
                },
                childMessage: {
                    type: String,
                    default: '默认'
                }
            }
        })


        const vm = new Vue({
            el: '#app',
            data: {
                message: '我是你爹!',
                info: {
                    name: '李民康',
                    age: 18,
                    sex: '男',
                }
            },
            methods: {},
            components: {
                cpn: cpn,
            }
        });
    </script>
</body>

</html>